import jieba

with open("sanguo.txt", "r", encoding="utf-8") as f:
    text = f.read()

words = jieba.lcut(text)
freq = {}
for w in words:
    if len(w) > 1:
        if w in freq:
            freq[w] += 1
        else:
            freq[w] = 1

sorted_freq = sorted(freq.items(), key=lambda x: x[1], reverse=True)

for w, f in sorted_freq:
    print(w, f)
